function loginCheck(){
	if(document.getElementsByName("identity_radio").item(0).checked)
	{
		if(document.getElementById("identity").value.length<8)
		{
			alert("你输入的学号长度不正确");
			return;
		}
		if(document.getElementById("identity").value.search("\\d{8}") < 0)
		{
			alert("学号必须全为数字");
			return;
		}
		//alert(document.getElementById("identity").value.length);
	}
	else
	{
		if(document.getElementById("identity").value.length < 4)
		{
			alert("你输入的工号长度不正确");
			return;
		}
		if(document.getElementById("identity").value.search("\\d{4}") < 0)
		{
			alert("工号必须全为数字");
			return;
		}
	}

	if(document.getElementById("pw").value.length < 1)
	{
		alert("请输入密码");
			return;
	}

		$.post("checkIdentity", {
			id: $("#identity").val(),
			pw: $("#pw").val(),
			identity_radio: $("input[name='identity_radio']:checked").val(),
			remb: $("#remB").attr("checked")},
			function(json){
				if(json.identity == 3){
					window.location = "student/student.jsp";
				}else if(json.identity == 2){
					window.location = "staff/staff.jsp";
				}else{
					alert("账号或密码有误。");
				}
			});
	//});
	return;
}

function alterTextLength(length)
{
	var text = document.getElementById("identity");

	if(text.value.length > length){
		text.value = text.value.substr(0,length);
	}
	document.getElementById("identity").maxLength = length;

}